
// AIR-related functions created by the developer
            
// reads the content of a local text file
function readLocalFile(){
	var f = air.File.applicationDirectory.resolvePath("LocalFile.txt");
		
    var fs = new air.FileStream();
    fs.open(f, air.FileMode.READ);
    var content = fs.readUTFBytes(fs.bytesAvailable);
    fs.close();
                
    return content;
}
            
// loads the content of a remote URL
function doRequest(url) {
	var req = new XMLHttpRequest();
    req.onreadystatechange = function() { 
        if (req.readyState == 4) {
    	   var str = req.responseText;
           if (str.length > 400) {
        	   str = str.substring(0, 399);
               str += "..";
           }
           alert('readystate: ' + req.readyState + '\n' +
           'status/statusText: ' + req.status + '/' + 
           req.statusText + '\n' +
           'responseText (400 chars): '  + "\n\n" + str);
        }
     };
     req.open('GET', url, true);
     req.send(null);                
}
			
function openInBrowser(url) {
	air.navigateToURL( new air.URLRequest(url)); 
}
            